/*
 * @Author: moeWang
 * @Date: 2021-09-07 15:27:08
 * @LastEditTime: 2021-09-07 15:59:50
 * @LastEditors: moeWang
 * @Description: 代理模式
 * @FilePath: \front-end-design-mode\code\Proxy.js
 */

function Person() {
    this.name = 'moe'
    this.getInfo = function(age) {
        console.log('name:' + this.name + ';age:' + age);
    }
}
// 代理类
function Proxy(person) {
    this.person = person
    this.setAge = function(age) {
        age += '岁'
        this.person.getInfo(age)
    }
}

var myProxy = new Proxy(new Person)
myProxy.setAge('18')